#[derive(Debug)]
struct Dog {
    name: String,
    weight: f32,
    height: f32,
}
// 方法的写法
impl Dog {
    fn get_name(&self) -> &str {
        &self.name
    }
    fn get_weight(&self) -> f32 {
        self.weight
    }
    fn get_height(&self) -> f32 {
        self.height
    }
    fn show() {
        println!("汪汪汪")
    }
}

fn main() {
    let dog = Dog {
        name: String::from("wang"),
        weight: 100.0,
        height: 70.8,
    };
    println!("dog = {:#?}", dog); // 打印结构体

    // 打印方法
    println!("get_name = {:?}", dog.get_name());
    println!("get_weight = {:?}", dog.get_weight());
    println!("get_height = {:?}", dog.get_height());
    Dog::show();
}
